//
//  ClassRecordCtry.m
//  ZHZtest
//
//  Created by 李彦宏 on 2018/1/2.
//  Copyright © 2018年 LYH. All rights reserved.
//

#import "ClassRecordCtry.h"
#import "GRStuOrTeaViewController.h"//学生约我界面
#import "GRTeaOrStuViewController.h"//我约学生界面


@interface ClassRecordCtry ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic, strong) UITableView *ClassRecordtable;
@property (nonatomic, strong) NSArray *Classinfo;
@end

@implementation ClassRecordCtry
//UItableView初始化
- (void)setupTable
{
   _ClassRecordtable=[[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
//    //去出组上间距
//    _ClassRecordtable.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];
    _ClassRecordtable.separatorStyle= UITableViewCellSeparatorStyleSingleLine;
    
    _ClassRecordtable.backgroundColor=[UIColor whiteColor];
    _ClassRecordtable.showsHorizontalScrollIndicator=NO;
    _ClassRecordtable.showsVerticalScrollIndicator=NO;
    _ClassRecordtable.dataSource=self;
    _ClassRecordtable.delegate=self;
    _ClassRecordtable.separatorStyle=UITableViewCellSeparatorStyleNone;
    [self.view addSubview:self.ClassRecordtable];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    //加载_Classinfo数据
   _Classinfo=[NSArray arrayWithObjects:@"学生约我",@"我约学生", nil ];
    [self setupTable];
    // Do any additional setup after loading the view.
}
#pragma -mark -----------------------------tableview datasource and delegate---------------------------------
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _Classinfo.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 45;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    // 1.创建cell
    static NSString *ID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    }
    
    // 2.设置cell的数据
    cell.textLabel.text =_Classinfo[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.ClassRecordtable deselectRowAtIndexPath:indexPath animated:YES];
    switch (indexPath.row) {
        case 0:
        {
            GRTeaOrStuViewController *vc1=[[GRTeaOrStuViewController alloc]init];
            [self.navigationController pushViewController:vc1 animated:YES];
            NSLog(@"点击啦学生约我");
            break;
            
        }
        
        case 1:
        {
            GRStuOrTeaViewController *vc0=[[GRStuOrTeaViewController alloc]init];
            [self.navigationController pushViewController:vc0 animated:YES];
            NSLog(@"点击啦我约学生");
            break;
        }
           
    }
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 1;
}


- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 1;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
